package com.anli.leguansuo;

import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/9  9:05
 * 描述:
 */
@Mapper
@Repository
public interface LeGuanStockDao {

    @Select("select * from base_stock where goods_id=#{goodsId}")
    public Map<String,Object> getGooodsById(String goodsId);

    @Update("update base_stock set version=version+1,stock=#{stock} where version=#{version} and goods_id=#{goodsId}")
    public int updateStock(Map<String,Object> map);

    //===================task的方式

    @Insert("insert into base_task(goods_id,quantity)values(#{goodsId},#{lockStock})")
    public int insertTask(Map<String,Object> map);

    @Delete("delete from base_task where id=#{id}")
    public int deleteInfo(long id);


    @Select("select * from base_task limit 10")
    public List<Map<String,Object>> getTask();

    //=================task的方式

}
